{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def data_process(path):\n",
    "    data=pd.read_table(path)\n",
    "    data_pro=pd.DataFrame(columns=[\"Angle\",\"PSD\"])\n",
    "    data_pro.loc[:,\"Angle\"]=data.loc[145:,\";RAW4.00\"].apply(lambda x: eval(x.split(\",\")[0].strip())).reset_index(drop=True)\n",
    "    data_pro.loc[:,\"PSD\"]=data.loc[145:,\";RAW4.00\"].apply(lambda x: eval(x.split(\",\")[1].strip())).reset_index(drop=True)\n",
    "    return data_pro"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "path1=\"0.5wt%ZnO-8%pvdf_15%PCL.dql\"  #数据的路径\n",
    "path2=\"\"       #数据的路径\n",
    "save_img_name=\"\"+\".png\"  #保存图片的名字放到前面的双引号里面\n",
    "data1=data_process(path1)\n",
    "data2=data_process(path2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#图片尺寸\n",
    "plt.figure(figsize=(20,10))\n",
    "# plt.subplots\n",
    "ax=plt.axes()\n",
    "#需要绘制的数据1，即路径1的数据\n",
    "plt.plot(data1.iloc[:,0],data1.iloc[:,1]+1500,label=\"raw-pvdf\")\n",
    "#需要绘制的数据1，即路径1的数据\n",
    "plt.plot(data2.iloc[:,0],data2.iloc[:,1],label=\"fengjiao\")\n",
    "\n",
    "# plt.xticks(np.arange(data_pro.iloc[:,0][0],data_pro.iloc[:,0].iloc[-1],5))\n",
    "# plt.grid()\n",
    "#关闭坐标轴\n",
    "ax.spines[\"top\"].set_visible(False)\n",
    "ax.spines[\"right\"].set_visible(False)\n",
    "# ax.spines[\"left\"].set_visible(False)\n",
    "#关闭y轴刻度尺\n",
    "# plt.yticks([])\n",
    "#显示图例\n",
    "plt.legend()\n",
    "\n",
    "#保存图片\n",
    "plt.savefig(save_img_name)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
